using System;
using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
using org.tmatesoft.svn.core;
using org.tmatesoft.svn.core.wc;

namespace Subsync.Core.Subversion
{
	/// <summary>
	/// Author: Tsz Lai
	/// </summary>
	public class SVNMove : CommandBase 
    {
		private java.io.File source_path;
		private java.io.File destination_path;

		public SVNMove(string start, string end)
        {
			source_path = new java.io.File(start);
			destination_path = new java.io.File(end);
		}
		
		public override void Execute ()
		{
			Console.WriteLine("SVN move Execution");
			
			Tools.SetupLibrary();
			
			SVNClientManager cm = SVNClientManager.newInstance();
			SVNMoveClient mc = cm.getMoveClient();
			
			try
            {
				mc.doMove(this.source_path, this.destination_path);
			}
			catch (SVNException e)
            {
				throw new SVNExecuteException(e.getMessage());
			}
		}
	}
}
